﻿<%@ Page Language="C#" MasterPageFile="~/WebSite/manager.Master" AutoEventWireup="true" CodeFile="m_data_up.aspx.cs" Inherits="WebSite_m_data_up" Title="上传体测数据" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<script language="javascript" type="text/javascript">
 function checkFileType(){
    
    //得到上传文件的值
    var fileName=document.getElementById("FileUpLoad1").value;
    
    //返回String对象中子字符串最后出现的位置.
    var seat=fileName.lastIndexOf(".");
   
    //返回位于String对象中指定位置的子字符串并转换为小写.
    var extension=fileName.substring(seat).toLowerCase();
    
    var allowed=[".xls"];
    for(var i=0;i<allowed.length;i++){
        if(!(allowed[i]!=extension)){
            return true;
        }
    }
    alert("不支持"+extension+"格式");
    return false;
  }
</script>
<table>
    <tr>
        <asp:FileUpload ID="FileUpload1" runat="server" Width="250px" />
    </tr>
    <tr>
        <asp:Button ID="btnFileUpload" runat="server" OnClick="btnFileUpload_Click" Text="上传" />
    </tr>
</table>
</asp:Content>

